package com.sky.validation.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sky.validation.mvalidation.Money;
import lombok.Data;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;

@Data
public class UserDto {

    @NotNull(message = "学号不允许为空")
    @Positive(message = "学号必须为大于零的正数")
    private Integer id;

    @NotNull(message = "姓名不允许为空")
    private String name;

    @NotNull(message = "邮箱地址不能为空")
    @Email(message = "邮箱地址错误")
    private String email;

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    @Future(message = "时间必须大于现在时间")
    private Date date;

    @NotNull(message = "手机号码不能为空")
    @Size(max = 11, min = 11, message = "手机号码长度必须为11位")
    private String phone;

    @Money(message = "请输入正确格式金额")
    @NotNull(message = "金额不允许为空")
    private BigDecimal money;
}
